package com.ewzj.bigdata.mvp.ui.adapter

import android.content.Intent
import android.view.View

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.ewzj.bigdata.R
import com.ewzj.bigdata.app.config.AppKey
import com.ewzj.bigdata.mvp.model.rspbean.HourseType
import com.ewzj.bigdata.mvp.ui.activity.HourseListActivity
import com.ewzj.bigdata.mvp.ui.activity.MapActivity
import com.jess.arms.utils.UiUtils


/**
 * author:zhangjing
 * 作用:
 * return:
 */

class HourseTypeAdapter(data: List<HourseType>) : BaseQuickAdapter<HourseType, BaseViewHolder>(R.layout.item_typetag_flow, data) {

    override fun convert(baseViewHolder: BaseViewHolder, hourseType: HourseType) {
        baseViewHolder.setText(R.id.tv_tag, hourseType.name)
        baseViewHolder.getConvertView().setOnClickListener {
            if (hourseType.id == "1") {
                startActivity(1)
            } else if (hourseType.id == "2") {
                startActivity(2)
            } else if (hourseType.id == "4") {
                startActivity(4)
            } else if (hourseType.id == "5") {
                startActivity(5)
            } else if (hourseType.id == "0") {
                var intent = Intent(mContext, MapActivity::class.java)
                intent.putExtra(AppKey.EXTRA_ID,2)
                mContext.startActivity(intent)
            }
        }
    }

    internal fun startActivity(type: Int) {
        val intent = Intent(mContext, HourseListActivity::class.java)
        intent.putExtra(AppKey.EXTRA_DATA, type)
        mContext.startActivity(intent)
    }
}
